Documentation Standards Refactoring Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Refactor all 91 existing documentation files to meet the new documentation standards defined in Documentation/09-Meta/Documentation-Standards.md and integrate with the maintain-documentation skill.
Architecture: Multi-phase refactoring with token management strategy, progressive file updates, checkpoint commits, and session continuity protocol.
Tech Stack: Python scripts for analysis, Git for version control, Claude Code sessions for execution
Total Scope: 91 documentation files across 9 directory categories - Files with violations: 74 (81%) - Compliant files: 17 (19%)
Token Management Strategy
The Problem
This is a massive refactoring job that will likely exceed token limits in a single Claude Code session. We need a strategy to:
- Track progress across sessions - Know exactly where we left off
- Enable resumption - Pick up work without duplicating effort
- Maintain quality - Ensure consistency across all updates
- Commit frequently - Preserve work and enable rollback
The Solution: Progressive Refactoring with Checkpoints
Phase-Based Approach
Break the work into 9 phases (one per directory category), with each phase containing 5-15 files:
- Phase 1: 00-START-HERE (1 file) - ✅ Critical entry point
- Phase 2: 01-Architecture (6 files) - ✅ Critical system docs
- Phase 3: 02-Guides (14 files) - ✅ High traffic how-tos
- Phase 4: 03-Reference (9 files) - ⚠️ Technical specs
- Phase 5: 04-Decisions (4 files) - ⚠️ ADRs (special handling)
- Phase 6: 05-Troubleshooting (3 files) - ⚠️ Problem solving
- Phase 7: 06-Processes (13 files) - Standards & workflows
- Phase 8: 07-Meta (7 files) - Documentation about docs
- Phase 9: 08-Projects (28 files) - Project tracking
- Phase 10: 09-Business (6 files) - Business docs
Progress Tracking File
Create Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md:
# Documentation Standards Refactoring Progress
**Started**: 2025-11-02
**Status**: In Progress
**Current Phase**: 1 of 10
## Phase Completion
- [ ] Phase 1: 00-START-HERE (0/1)
- [ ] Phase 2: 01-Architecture (0/6)
- [ ] Phase 3: 02-Guides (0/14)
- [ ] Phase 4: 03-Reference (0/9)
- [ ] Phase 5: 04-Decisions (0/4)
- [ ] Phase 6: 05-Troubleshooting (0/3)
- [ ] Phase 7: 06-Processes (0/13)
- [ ] Phase 8: 07-Meta (0/7)
- [ ] Phase 9: 08-Projects (0/28)
- [ ] Phase 10: 09-Business (0/6)
## Files Updated
### Phase 1 (00-START-HERE)
<div class="kanban-column">
- [ ]</div>
Documentation/00-START-HERE.md
[... continues for all phases ...]
## Session Log
### Session 1 (2025-11-02)
- Started Phase 1
- Files completed: 0
- Token usage: 0/200000
[... continues for each session ...]
Checkpoint Commits
After each phase: 1. Run validation script 2. Commit with descriptive message 3. Update progress tracker 4. Push to remote (safety backup)
Session Continuity Protocol
When starting a new session (due to token limit):
- Read
REFACTORING-PROGRESS.md - Identify last completed phase
- Resume at next incomplete file
- Continue with standard workflow
When token limit approaches (<20k remaining):
- Complete current file
- Commit all changes
- Update progress tracker
- Stop gracefully with handoff message:
Token limit approaching. Completed Phase X. Next session: Resume at Phase Y, file Z. See REFACTORING-PROGRESS.md for details.
Standards Requirements Summary
Mandatory Header Format
Every documentation file MUST have:
# Title
**Status**: Active|Reference|Archived
**Last Updated**: YYYY-MM-DD
**Related Docs**: [links to related documentation]
**Code Location**: `path/to/code.py` (if applicable)
---
Status Values
- Active - Living document, frequently updated
- Reference - Stable reference material
- Archived - Historical record, no longer current
Additional Requirements
- File names must use
kebab-case(already compliant) - Links must use relative paths (already mostly compliant)
- Code examples must have language identifiers
- Diagrams should use Mermaid when possible
- No broken links
- No TODOs without issue numbers
Directory-Specific Considerations
06-Decisions/ (ADRs - Special Handling)
IMPORTANT: ADRs have their own format standard defined in Documentation/06-Decisions/README.md.
Standard ADR format:
# ADR-XXX: Title
**Date**: YYYY-MM-DD
**Status**: Proposed|Accepted|Rejected|Superseded
**Deciders**: [Names]
## Context
[...]
## Decision
[...]
## Rationale
[...]
## Consequences
[...]
For this refactoring: - Keep existing ADR structure - Add Last Updated: field if modified - Add Related Docs: field for cross-references - Do NOT change Status, Date, or Deciders fields - Validate but do not reformat
10-Projects/ (Project Docs - Status-Dependent)
Active Projects (in 10-Projects/Active/):
- Status: Active or In Progress
- Must have current Last Updated date
- Should include progress tracking
Archived Projects (in 10-Projects/Archive/YYYY-QX/):
- Status: Archived
- Last Updated: Date of completion
- Add completion metadata
09-Meta/ (Meta Docs - Already Mostly Compliant)
These are the standard-defining documents:
- Documentation-Standards.md - Already compliant
- Maintenance-Guide.md - Check compliance
- Others may need updates
Implementation Tasks
Pre-Phase: Setup and Validation
Task 1: Create Progress Tracker
Files:
- Create: Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
Step 1: Create the progress tracking file
cat > Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md << 'EOF'
# Documentation Standards Refactoring Progress
**Started**: 2025-11-02
**Status**: In Progress
**Current Phase**: 0 of 10 (Setup)
## Phase Completion
- [ ] Phase 0: Setup and Validation (0/3)
- [ ] Phase 1: 00-START-HERE (0/1)
- [ ] Phase 2: 01-Architecture (0/6)
- [ ] Phase 3: 02-Guides (0/14)
- [ ] Phase 4: 03-Reference (0/9)
- [ ] Phase 5: 04-Decisions (0/4)
- [ ] Phase 6: 05-Troubleshooting (0/3)
- [ ] Phase 7: 06-Processes (0/13)
- [ ] Phase 8: 07-Meta (0/7)
- [ ] Phase 9: 08-Projects (0/28)
- [ ] Phase 10: 09-Business (0/6)
## Current Session
**Session**: 1
**Date**: 2025-11-02
**Phase**: 0 (Setup)
**Token Usage**: 0/200000
**Files Completed This Session**: 0
## Files Updated
### Phase 0: Setup and Validation
<div class="kanban-column">
- [ ]</div>
Create validation script
- [ ] Create progress tracker
- [ ] Initial commit
### Phase 1: 00-START-HERE
<div class="kanban-column">
- [ ]</div>
Documentation/00-START-HERE.md
### Phase 2: 01-Architecture
<div class="kanban-column">
- [ ]</div>
Documentation/03-Architecture/Core-Principles.md
- [ ] Documentation/03-Architecture/EPG-Matching-Pipeline.md
- [ ] Documentation/03-Architecture/Family-League-Inference.md
- [ ] Documentation/03-Architecture/Subdomain-Design.md
- [ ] Documentation/03-Architecture/System-Overview.md
- [ ] Documentation/03-Architecture/Technology-Stack.md
### Phase 3: 02-Guides
<div class="kanban-column">
- [ ]</div>
Documentation/04-Guides/Cloudflare-Setup.md
- [ ] Documentation/04-Guides/Command-Reference.md
- [ ] Documentation/05-Reference/Database/Credentials.md
- [ ] Documentation/05-Reference/Database/Supabase-Setup.md
- [ ] Documentation/04-Guides/Deployment.md
- [ ] Documentation/04-Guides/Development-Setup.md
- [ ] Documentation/04-Guides/EPG-Generation.md
- [ ] Documentation/04-Guides/M3U-Snapshots.md
- [ ] Documentation/04-Guides/Pattern-Matching.md
- [ ] Documentation/04-Guides/Quick-Start.md
### Phase 4: 03-Reference
<div class="kanban-column">
- [ ]</div>
Documentation/05-Reference/API/API_INTEGRATION.md
- [ ] Documentation/05-Reference/API/API_V2_MIGRATION.md
- [ ] Documentation/05-Reference/API/REST-API.md
- [ ] Documentation/05-Reference/API/SEARCHEVENTS_DEPRECATION.md
- [ ] Documentation/05-Reference/Database/README.md
- [ ] Documentation/05-Reference/Database/Schema.md
- [ ] Documentation/05-Reference/Event-Details-Cache.md
- [ ] Documentation/05-Reference/Glossary.md
- [ ] Documentation/05-Reference/Product/README.md
### Phase 5: 04-Decisions
<div class="kanban-column">
- [ ]</div>
Documentation/06-Decisions/001-D1-Database-Migration.md
- [ ] Documentation/06-Decisions/002-EPG-Matching-Architecture.md
- [ ] Documentation/06-Decisions/README.md
- [ ] Documentation/06-Decisions/STUB-TEMPLATE.md
### Phase 6: 05-Troubleshooting
<div class="kanban-column">
- [ ]</div>
Documentation/07-Troubleshooting/Match-Failures.md
- [ ] Documentation/07-Troubleshooting/Performance-Issues.md
- [ ] Documentation/07-Troubleshooting/System-Gaps.md
### Phase 7: 06-Processes
<div class="kanban-column">
- [ ]</div>
Documentation/08-Processes/CI-CD-Pipeline.md
- [ ] Documentation/02-Standards/00-Core-Principles.md
- [ ] Documentation/02-Standards/01-Python-Standards.md
- [ ] Documentation/02-Standards/02-TypeScript-Standards.md
- [ ] Documentation/02-Standards/03-Architecture-Patterns.md
- [ ] Documentation/02-Standards/04-Testing-Standards.md
- [ ] Documentation/02-Standards/05-Documentation-Standards.md
- [ ] Documentation/02-Standards/06-Git-Workflow.md
- [ ] Documentation/02-Standards/07-Database-Standards.md
- [ ] Documentation/02-Standards/08-Error-Handling.md
- [ ] Documentation/02-Standards/09-Security-Standards.md
- [ ] Documentation/02-Standards/ENGINEERING-STANDARDS-COMPLETE.md
- [ ] Documentation/02-Standards/README.md
### Phase 8: 07-Meta
<div class="kanban-column">
- [ ]</div>
Documentation/09-Meta/AUDIT-SUMMARY.md
- [ ] Documentation/09-Meta/DOCUMENTATION-AUDIT-2025-11-02.md
- [ ] Documentation/09-Meta/DOCUMENTATION-CLEANUP-PLAN.md
- [ ] Documentation/09-Meta/Documentation-Standards.md (VERIFY ONLY)
- [ ] Documentation/09-Meta/Maintenance-Guide.md
- [ ] Documentation/09-Meta/MIGRATION-PLAN.md
- [ ] Documentation/01-Work-In-Progress/DOCUMENTATION_UPDATE_CHECKLIST.md
### Phase 9: 08-Projects
<div class="kanban-column">
- [ ]</div>
Documentation/10-Projects/Active/2025-11-02-provider-onboarding-service-design.md
- [ ] Documentation/10-Projects/Active/Admin-Enhancements.md
- [ ] Documentation/10-Projects/Active/API-Match-Overhaul.md
- [ ] Documentation/10-Projects/Active/Billing-System.md
- [ ] Documentation/10-Projects/Active/Public-Frontend.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/API-Efficiency-Fix.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/CLEANUP_SUMMARY.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Cost-Tracker-Integration.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Cross-Provider-Cache.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1_MIGRATION_COMPLETE.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1_MIGRATION_SUMMARY.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1_MODE_TEST_RESULTS.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1_PIPELINE_FIX.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1-Batch-Upsert-Fix.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1-Batching-Analysis.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/D1-Race-Condition-Fix.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Date-Tolerance-Feature.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Enhanced-Match-Cache.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Family-Stats-Tracker.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/League-Normalization.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/MISMATCH_TRACKER_D1_MIGRATION.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/MULTI_PROVIDER_ARCHITECTURE_STATUS.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Multi-Provider-Architecture-Design.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/PHASE_2_PARSER_COMPLETE.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/PHASE_3_CONFIG_MANAGER_COMPLETE.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Phase-2-Integration.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/REFRESH_EVENT_DB_D1_MIGRATION.md
- [ ] Documentation/10-Projects/Archive/2024-Q4/Regex-Matcher-Integration.md
- [ ] Documentation/10-Projects/Archive/README.md
### Phase 10: 09-Business
<div class="kanban-column">
- [ ]</div>
Documentation/11-Business/cost-model.md
- [ ] Documentation/11-Business/pricing-strategy.md
- [ ] Documentation/11-Business/Product/byo-builder.md
- [ ] Documentation/11-Business/Product/premium-features.md
- [ ] Documentation/11-Business/Product/provider-packs.md
- [ ] Documentation/11-Business/Product/README.md
## Session Log
### Session 1 (2025-11-02)
- **Started**: Phase 0 (Setup)
- **Completed**: 0 files
- **Token Usage**: 0/200000
- **Notes**: Created progress tracker and validation script
EOF
Step 2: Commit progress tracker
git add Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: create refactoring progress tracker
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 2: Create Validation Script
Files:
- Create: scripts/validate_documentation_standards.py
Step 1: Create validation script
#!/usr/bin/env python3
"""
Validate documentation files against standards.
Checks:
1. Header presence (Status, Last Updated, separator)
2. File naming (kebab-case)
3. Link validity (relative paths exist)
4. Code blocks have language identifiers
5. No broken TODO items
"""
import os
import re
from pathlib import Path
from typing import List, Tuple
def validate_header(filepath: Path, content: str) -> List[str]:
"""Validate file header against standards."""
violations = []
lines = content.split('\n')[:20] # Check first 20 lines
header_text = '\n'.join(lines)
# Check for Status field (mandatory)
if not re.search(r'\*\*Status\*\*:', header_text):
violations.append("Missing **Status**: field in header")
# Check for Last Updated field (mandatory)
if not re.search(r'\*\*Last Updated\*\*:', header_text):
violations.append("Missing **Last Updated**: field in header")
# Check for header separator --- (mandatory)
if '---' not in header_text:
violations.append("Missing header separator (---)")
return violations
def validate_file_naming(filepath: Path) -> List[str]:
"""Validate file naming convention (kebab-case)."""
violations = []
filename = filepath.stem # Without .md extension
# Allow uppercase for special files (README, ADR-001, etc.)
if filename.isupper() or filename.startswith('ADR-'):
return violations
# Check for kebab-case (allow numbers)
if not re.match(r'^[a-z0-9]+(-[a-z0-9]+)*$', filename):
violations.append(f"Filename '{filename}' not in kebab-case")
return violations
def validate_links(filepath: Path, content: str, docs_root: Path) -> List[str]:
"""Validate relative links exist."""
violations = []
# Find all markdown links [text](path)
link_pattern = r'\[([^\]]+)\]\(([^)]+)\)'
links = re.findall(link_pattern, content)
for text, link in links:
# Skip external links, anchors, and images
if link.startswith(('http://', 'https://', '#', 'mailto:')):
continue
# Handle anchor links (file.md#section)
if '#' in link:
link = link.split('#')[0]
if not link: # Pure anchor link like #section
continue
# Resolve relative path
link_path = (filepath.parent / link).resolve()
if not link_path.exists():
violations.append(f"Broken link: [{text}]({link})")
return violations
def validate_code_blocks(content: str) -> List[str]:
"""Validate code blocks have language identifiers."""
violations = []
# Find code blocks without language identifier
# Pattern: ``` followed by newline (not ```python, ```bash, etc.)
code_block_pattern = r'```\s*\n'
matches = re.finditer(code_block_pattern, content)
count = len(list(re.finditer(code_block_pattern, content)))
if count > 0:
violations.append(f"{count} code block(s) missing language identifier")
return violations
def validate_file(filepath: Path, docs_root: Path) -> Tuple[bool, List[str]]:
"""
Validate a single documentation file.
Returns:
(is_valid, violations)
"""
try:
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
except Exception as e:
return False, [f"Error reading file: {e}"]
violations = []
# Run all validation checks
violations.extend(validate_header(filepath, content))
violations.extend(validate_file_naming(filepath))
violations.extend(validate_links(filepath, content, docs_root))
violations.extend(validate_code_blocks(content))
is_valid = len(violations) == 0
return is_valid, violations
def main():
"""Main validation routine."""
docs_root = Path("Documentation")
if not docs_root.exists():
print("❌ Documentation directory not found")
return 1
# Find all .md files
md_files = list(docs_root.rglob("*.md"))
print(f"🔍 Validating {len(md_files)} documentation files...")
print()
valid_count = 0
invalid_count = 0
all_violations = []
for filepath in sorted(md_files):
is_valid, violations = validate_file(filepath, docs_root)
if is_valid:
valid_count += 1
print(f"✅ {filepath}")
else:
invalid_count += 1
print(f"❌ {filepath}")
for violation in violations:
print(f" - {violation}")
all_violations.append((filepath, violation))
print()
# Summary
print("=" * 80)
print(f"📊 Validation Summary")
print(f" Total files: {len(md_files)}")
print(f" ✅ Valid: {valid_count}")
print(f" ❌ Invalid: {invalid_count}")
print(f" 📝 Total violations: {len(all_violations)}")
print("=" * 80)
if invalid_count > 0:
return 1
else:
print("🎉 All documentation files meet standards!")
return 0
if __name__ == "__main__":
exit(main())
Step 2: Make script executable
chmod +x scripts/validate_documentation_standards.py
Step 3: Test the validation script
cd /Users/abel_flores/Documents/GitHub/epgoat-internal
python3 scripts/validate_documentation_standards.py
Expected output: Should show 74 files with violations
Step 4: Commit validation script
git add scripts/validate_documentation_standards.py
git commit -m "feat: add documentation standards validation script
- Validates headers (Status, Last Updated, separator)
- Checks file naming (kebab-case)
- Validates relative links
- Checks code blocks have language identifiers
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 3: Initial Checkpoint Commit
Step 1: Update progress tracker
Mark Phase 0 tasks as complete in REFACTORING-PROGRESS.md.
Step 2: Commit progress
git add Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: complete Phase 0 setup
- Created progress tracker
- Created validation script
- Ready to begin Phase 1
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 3: Push to remote (safety backup)
git push
Phase 1: 00-START-HERE (1 file)
Priority: CRITICAL - This is the entry point for all documentation
Task 4: Update 00-START-HERE.md
Files:
- Modify: Documentation/00-START-HERE.md
Step 1: Read current file
# Already done via Read tool earlier
Step 2: Identify required changes
Based on current state: - ✅ Has title: "# EPGOAT Documentation - START HERE" - ❌ Missing Status: field - ❌ Missing Last Updated: field - ✅ Has separator "---" (multiple) - ❌ Missing Related Docs: field
Step 3: Add header fields
Add after the title and welcome message, before first "---":
**Status**: Active
**Last Updated**: 2025-11-02
**Related Docs**: [Documentation Standards](09-Meta/Documentation-Standards.md), [Maintenance Guide](09-Meta/Maintenance-Guide.md)
Step 4: Verify no broken links
Check all links in the file still work (spot check 5-10 links).
Step 5: Update progress tracker
Mark Documentation/00-START-HERE.md as complete in REFACTORING-PROGRESS.md.
Step 6: Commit
git add Documentation/00-START-HERE.md Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: update 00-START-HERE.md to meet standards
- Add Status field (Active)
- Add Last Updated field (2025-11-02)
- Add Related Docs links
- Verify all internal links work
Phase 1 complete (1/1 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Phase 2: 01-Architecture (6 files)
Priority: CRITICAL - Core system architecture documentation
Task 5: Update Core-Principles.md
Files:
- Modify: Documentation/03-Architecture/Core-Principles.md
Step 1: Read file
Step 2: Analyze current header
Identify what's missing from required header fields.
Step 3: Add/update header fields
Ensure complete header:
# Core Principles
**Status**: Active|Reference
**Last Updated**: 2025-11-02
**Related Docs**: [System Overview](System-Overview.md), [Documentation Standards](../09-Meta/Documentation-Standards.md)
**Code Location**: N/A (Architectural principles)
---
Choose appropriate Status based on content:
- If frequently changing principles: Active
- If stable foundational principles: Reference
Step 4: Verify code examples have language identifiers
Search for code blocks (```) without language identifiers, add them.
Step 5: Check links
Verify all relative links work.
Step 6: Update progress tracker
Step 7: Commit
git add Documentation/03-Architecture/Core-Principles.md Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: update Core-Principles.md to meet standards
- Add/update complete header
- Verify code blocks have language identifiers
- Check links
Phase 2 (1/6 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 6-10: Update Remaining Architecture Files
Repeat the same pattern for:
- EPG-Matching-Pipeline.md
- Family-League-Inference.md
- Subdomain-Design.md
- System-Overview.md (already has header, verify completeness)
- Technology-Stack.md
For each file:
1. Read file
2. Analyze header
3. Add/update header fields
4. Fix code blocks
5. Check links
6. Determine appropriate Status:
- Active - If architecture is evolving
- Reference - If stable architecture description
7. Add Related Docs (link to System-Overview, relevant ADRs, guides)
8. Update progress tracker
9. Commit individual file
Commit message template:
git commit -m "docs: update [filename] to meet standards
- Add/update complete header (Status: [Active|Reference])
- Add Related Docs links
- Fix code blocks
- Verify links
Phase 2 ([X]/6 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 11: Phase 2 Checkpoint
Step 1: Validate Phase 2 files
python3 scripts/validate_documentation_standards.py | grep "01-Architecture"
Expected output: All 6 Architecture files should show ✅
Step 2: Update progress tracker
Mark Phase 2 as complete.
Step 3: Commit checkpoint
git add Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: complete Phase 2 (Architecture) - 6 files
All architecture documentation now meets standards:
- Complete headers (Status, Last Updated, Related Docs)
- Code blocks with language identifiers
- Valid links
Next: Phase 3 (Guides) - 14 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 4: Push to remote
git push
Phase 3: 02-Guides (14 files)
Priority: HIGH - High-traffic how-to documentation
Files: 1. Cloudflare-Setup.md 2. Command-Reference.md 3. D1_CREDENTIALS.md 4. D1_MANAGER_SETUP.md 5. Deployment.md 6. Development-Setup.md 7. EPG-Generation.md 8. M3U-Snapshots.md 9. Pattern-Matching.md 10. Quick-Start.md (already has partial header)
Task 12-25: Update Guide Files (14 tasks)
For each guide file:
- Read file
- Analyze current header
- Add/update header fields ```markdown # [Guide Title]
Status: Active
Last Updated: 2025-11-02
Related Docs: Architecture Doc, Reference Doc
Code Location: path/to/code (if applicable)
```
Note: All guides should be Status: Active (they're how-to docs that evolve)
- Verify guide structure matches template
- Has "Prerequisites" section?
- Steps are numbered?
- Code examples have language identifiers?
- Expected outputs shown?
-
Troubleshooting section exists?
-
Fix any code blocks missing language identifiers
-
Check links (especially to architecture and reference docs)
-
Add Code Location if applicable (link to relevant code in
engineering/) -
Update progress tracker
-
Commit individual file
Commit message template:
git commit -m "docs: update [filename] to meet standards
- Add complete header (Status: Active)
- Add Related Docs links to architecture/reference
- Add Code Location if applicable
- Fix code block language identifiers
- Verify guide structure
Phase 3 ([X]/14 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 26: Phase 3 Checkpoint
Step 1: Validate Phase 3 files
python3 scripts/validate_documentation_standards.py | grep "02-Guides"
Step 2: Update progress tracker
Step 3: Commit checkpoint
git commit -m "docs: complete Phase 3 (Guides) - 14 files
All guide documentation now meets standards.
Next: Phase 4 (Reference) - 9 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 4: Check token usage
If token usage > 160,000, prepare for session handoff. Otherwise continue.
Step 5: Push to remote
git push
Phase 4: 03-Reference (9 files)
Priority: HIGH - Technical specification documentation
Files: 1. API/API_INTEGRATION.md 2. API/API_V2_MIGRATION.md 3. API/REST-API.md 4. API/SEARCHEVENTS_DEPRECATION.md 5. Database/README.md 6. Database/Schema.md 7. Event-Details-Cache.md 8. Glossary.md 9. Product/README.md
Task 27-35: Update Reference Files (9 tasks)
For each reference file:
- Read file
- Analyze current header
- Add/update header fields ```markdown # [Reference Title]
Status: Reference
Last Updated: 2025-11-02
Related Docs: Practical Guide
Code Location: path/to/implementation (if applicable)
```
Note: Reference docs should be Status: Reference (stable specs)
- Verify reference structure
- Has complete specification tables?
- All fields documented with types?
-
Examples provided?
-
Fix code blocks
-
Check links
-
Update progress tracker
-
Commit
Commit message template:
git commit -m "docs: update [filename] to meet standards
- Add complete header (Status: Reference)
- Add Related Docs links to guides
- Add Code Location if applicable
- Fix code blocks
- Verify specification completeness
Phase 4 ([X]/9 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 36: Phase 4 Checkpoint
Step 1: Validate
python3 scripts/validate_documentation_standards.py | grep "03-Reference"
Step 2: Update progress tracker
Step 3: Commit checkpoint
git commit -m "docs: complete Phase 4 (Reference) - 9 files
Next: Phase 5 (Decisions/ADRs) - 4 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 4: Check token usage
If token usage > 170,000, stop and prepare handoff message.
Step 5: Push to remote
git push
Phase 5: 04-Decisions (4 files) - SPECIAL HANDLING
Priority: HIGH - Architecture Decision Records
IMPORTANT: ADRs have their own format. Do NOT restructure them.
Files: 1. 001-D1-Database-Migration.md 2. 002-EPG-Matching-Architecture.md 3. README.md 4. STUB-TEMPLATE.md
Task 37-40: Update ADR Files (4 tasks)
For each ADR file:
- Read file
- Check current format
- Minimal updates only:
- If missing Last Updated, add it (set to original Date or latest edit date)
- If missing Related Docs, add it (link to relevant architecture docs)
- Do NOT change: Date, Status, Deciders
-
Do NOT reformat the ADR structure
-
Example minimal addition: ```markdown # ADR-001: Title
Date: 2024-11-01 Status: Accepted Deciders: [Names] Last Updated: 2025-11-02 ← ADD THIS IF MISSING Related Docs: System Overview ← ADD THIS IF MISSING
## Context [existing content] ```
- Verify ADR has all required sections:
- Context
- Decision
- Rationale
-
Consequences
-
Update progress tracker
-
Commit
Commit message template:
git commit -m "docs: update [ADR filename] with cross-references
- Add Last Updated field if missing
- Add Related Docs links
- Preserve ADR format and content
Phase 5 ([X]/4 files)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Task 41: Phase 5 Checkpoint
Step 1: Validate (with special ADR rules)
python3 scripts/validate_documentation_standards.py | grep "04-Decisions"
Step 2: Commit checkpoint
git commit -m "docs: complete Phase 5 (Decisions) - 4 files
ADRs updated with minimal changes (cross-references only).
Original ADR format preserved.
Next: Phase 6 (Troubleshooting) - 3 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 3: Push
git push
Phase 6: 05-Troubleshooting (3 files)
Priority: HIGH - Problem-solving documentation
Files: 1. Match-Failures.md 2. Performance-Issues.md 3. System-Gaps.md
Task 42-44: Update Troubleshooting Files (3 tasks)
For each troubleshooting file:
- Read file
- Add/update header: ```markdown # Troubleshooting: [Topic]
Status: Active
Last Updated: 2025-11-02
Related Docs: Architecture, Guide
Code Location: path/to/relevant/code
```
- Verify troubleshooting structure:
- Issues are titled clearly?
- Has Symptoms, Root Cause, Diagnosis, Solutions?
-
Links to relevant architecture/code?
-
Fix code blocks
-
Update progress tracker
-
Commit
Task 45: Phase 6 Checkpoint
git commit -m "docs: complete Phase 6 (Troubleshooting) - 3 files
Next: Phase 7 (Processes/Standards) - 13 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
git push
Phase 7: 06-Processes (13 files)
Priority: MEDIUM - Process and standards documentation
Files: (Engineering Standards + CI/CD)
Task 46-58: Update Process Files (13 tasks)
Note: Many engineering standards files may already be compliant since they're recent. Verify and update only what's missing.
For each file: 1. Read and verify header compliance 2. Update only if needed 3. Engineering standards should be Status: Reference (they're stable rules) 4. CI/CD should be Status: Active (evolving process)
Task 59: Phase 7 Checkpoint
git commit -m "docs: complete Phase 7 (Processes) - 13 files
Next: Phase 8 (Meta) - 7 files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
git push
Phase 8: 07-Meta (7 files)
Priority: MEDIUM - Documentation about documentation
Files: 1. AUDIT-SUMMARY.md 2. DOCUMENTATION-AUDIT-2025-11-02.md 3. DOCUMENTATION-CLEANUP-PLAN.md 4. Documentation-Standards.md (VERIFY ONLY - already compliant) 5. Maintenance-Guide.md 6. MIGRATION-PLAN.md 7. 01-Work-In-Progress/DOCUMENTATION_UPDATE_CHECKLIST.md
Task 60-66: Update Meta Files (7 tasks)
Special note: Documentation-Standards.md should already be compliant. Just verify.
For audit/plan files: These are historical records. Set Status to Archived if completed, Active if ongoing.
Task 67: Phase 8 Checkpoint
git commit -m "docs: complete Phase 8 (Meta) - 7 files
Next: Phase 9 (Projects) - 28 files (LARGEST PHASE)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
git push
IMPORTANT: Phase 9 has 28 files. Check token usage before starting. If > 150k tokens used, stop here and prepare handoff.
Phase 9: 08-Projects (28 files) - LARGEST PHASE
Priority: MEDIUM - Project tracking documentation
Files: - 5 Active projects - 23 Archived projects - 1 README
Task 68-95: Update Project Files (28 tasks)
Active Projects (Status: Active): 1. 2025-11-02-provider-onboarding-service-design.md 2. Admin-Enhancements.md 3. API-Match-Overhaul.md 4. Billing-System.md 5. Public-Frontend.md
For Active Projects:
# Project: [Name]
**Status**: Active
**Last Updated**: 2025-11-02
**Related Docs**: [ADR](../../06-Decisions/...), [Architecture](../../03-Architecture/...)
**Started**: [Original date]
**Target Completion**: [Target date]
---
Archived Projects (Status: Archived): - 23 files in Archive/2024-Q4/
For Archived Projects:
# Project: [Name] - COMPLETE ✅
**Date Completed**: [Completion date]
**Status**: Archived
**Quarter**: 2024-Q4
**Related ADRs**: [ADR-001](../../06-Decisions/001-...)
**Code Location**: `path/to/code`
---
Strategy for Phase 9:
Due to size, consider breaking into sub-phases: - Phase 9A: Active projects (5 files) - Phase 9B: Archived projects batch 1 (12 files) - Phase 9C: Archived projects batch 2 (11 files)
Commit after each sub-phase for token management.
Task 96: Phase 9 Checkpoint
git commit -m "docs: complete Phase 9 (Projects) - 28 files
Largest phase complete. All project tracking docs now compliant.
Next: Phase 10 (Business) - 6 files (FINAL PHASE)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
git push
Phase 10: 09-Business (6 files) - FINAL PHASE
Priority: LOW - Business documentation
Files: 1. cost-model.md 2. pricing-strategy.md 3. Product/byo-builder.md 4. Product/premium-features.md 5. Product/provider-packs.md 6. Product/README.md
Task 97-102: Update Business Files (6 tasks)
For each business file:
# [Business Topic]
**Status**: Active
**Last Updated**: 2025-11-02
**Related Docs**: [Product Reference](../05-Reference/Product/)
---
Business docs are typically Active (they evolve with business decisions).
Task 103: Final Validation
Step 1: Run full validation
python3 scripts/validate_documentation_standards.py
Expected output:
📊 Validation Summary
Total files: 91
✅ Valid: 91
❌ Invalid: 0
📝 Total violations: 0
🎉 All documentation files meet standards!
Step 2: Update progress tracker to COMPLETE
Update REFACTORING-PROGRESS.md:
**Status**: COMPLETE ✅
**Completed**: 2025-11-02
All 91 documentation files now meet standards.
Step 3: Final commit
git add Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
git commit -m "docs: complete Phase 10 (Business) - 6 files
🎉 REFACTORING COMPLETE
All 91 documentation files now meet standards:
- Complete headers (Status, Last Updated, Related Docs, Code Location)
- Code blocks with language identifiers
- Valid relative links
- Proper file naming
Total phases: 10
Total files: 91
Total commits: ~100+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 4: Push final changes
git push
Step 5: Celebrate!
The entire documentation system is now compliant with standards and ready for automated maintenance via the maintain-documentation skill.
Token Limit Recovery Protocol
When Token Limit Approaches (<20k remaining)
STOP IMMEDIATELY and follow this protocol:
Step 1: Complete Current File
Finish updating the current documentation file you're working on.
Step 2: Commit Current Progress
git add [current files]
git commit -m "docs: [phase name] - WIP checkpoint
Completed [X] of [Y] files in this phase.
Next file: [filename]
Token limit approached, stopping for session handoff.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>"
Step 3: Update Progress Tracker
Mark completed files in REFACTORING-PROGRESS.md and update session log:
### Session [N] (2025-11-02)
- **Started**: Phase [X]
- **Completed**: [N] files
- **Token Usage**: [current]/200000
- **Stopped At**: [Filename]
- **Reason**: Token limit approaching
- **Next Session**: Resume at [next file]
Step 4: Push to Remote
git push
Step 5: Provide Handoff Message
Output this message to the user:
⚠️ TOKEN LIMIT APPROACHING
Progress saved successfully.
📊 Current Status:
- Phase: [X] of 10
- Files completed this session: [N]
- Next file: [filename]
✅ All progress committed and pushed to remote.
📋 To Resume:
1. Start new Claude Code session
2. Read: Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
3. Continue at: [filename]
4. Follow same task pattern
The refactoring plan and validation script are in place.
All completed work is safely committed.
Starting a New Session (After Token Limit)
When starting a new Claude Code session to continue:
Step 1: Read Progress Tracker
# This will be done automatically via Read tool
Read Documentation/01-Work-In-Progress/REFACTORING-PROGRESS.md
Step 2: Identify Resume Point
Find the last completed file and next file to work on.
Step 3: Resume Workflow
Continue with the same task pattern: 1. Read file 2. Analyze header 3. Update header 4. Fix code blocks 5. Check links 6. Commit
Step 4: Update Session Log
Add new session entry to progress tracker.
Success Criteria
This plan succeeds when:
- ✅ All 91 documentation files have complete headers
- ✅ All files pass validation script
- ✅ All code blocks have language identifiers
- ✅ All relative links are valid
- ✅ Progress tracker shows 100% completion
- ✅ All changes committed and pushed
- ✅ Documentation system ready for
maintain-documentationskill
This plan fails when:
- ❌ Files left without proper headers
- ❌ Broken links introduced
- ❌ ADR format broken
- ❌ Progress not tracked/committed
- ❌ Work lost due to token limit without handoff
Estimated Effort
Total Tasks: 103 Estimated Time: 8-12 hours (across multiple sessions) Estimated Commits: 100+ Estimated Token Usage: 400k-600k (2-3 sessions)
Per Phase: - Phase 0: Setup - 15 mins - Phase 1: 1 file - 5 mins - Phase 2: 6 files - 30 mins - Phase 3: 14 files - 1 hour - Phase 4: 9 files - 45 mins - Phase 5: 4 files - 20 mins - Phase 6: 3 files - 15 mins - Phase 7: 13 files - 1 hour - Phase 8: 7 files - 30 mins - Phase 9: 28 files - 2 hours - Phase 10: 6 files - 30 mins - Final validation: 15 mins
Related Documentation
- Documentation Standards - Standards being applied
- maintain-documentation Skill - Maintenance automation
- Maintenance Guide - Ongoing maintenance
Notes for Future Maintainers
This refactoring enables:
1. Automated documentation maintenance via maintain-documentation skill
2. Easy validation via validate_documentation_standards.py
3. Consistent documentation quality across all files
4. Better discoverability via complete headers
5. Reduced documentation drift
After this refactoring:
- Run validation script before commits
- Use maintain-documentation skill when changing code
- Keep headers updated (especially Last Updated dates)
- Add new docs with proper headers from start